package com.springboot.starter.coderacademy.base;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @version1.0
 * @description:<p></p>
 * @author:码农Academy
 * @create:2024/1/3114:38
 */

@Configuration
@ConditionalOnMissingBean(CoderAcademyService.class)
@EnableConfigurationProperties({CoderAcademyProperties.class})
@PropertySource(name = "CoderAcademy Default Properties", value = "classpath:/META-INF/coderacademy-default.properties")
public class CoderAcademyAutoConfig {

    @Bean
    public CoderAcademyService coderAcademyService(CoderAcademyProperties coderAcademyProperties) {
        return new CoderAcademyService(coderAcademyProperties);
    }
}

